package com.tfjybj.itoo.teach.provider.controller;

import com.dmsdbj.itoo.tool.base.entity.YearSemesterEntity;
import com.dmsdbj.itoo.tool.business.ItooResult;
import com.dmsdbj.itoo.tool.constantutil.YearSemester;
import com.github.pagehelper.PageInfo;
import com.tfjybj.itoo.teach.entity.StudentEntity;
import com.tfjybj.itoo.teach.model.StudentModel;
import com.tfjybj.itoo.teach.provider.service.StudentService;
import io.swagger.annotations.*;
import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.List;

//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.dmsdbj.itoo.authorizationManagement.entity.AllusersEntity;
//import com.dmsdbj.itoo.authorizationManagement.facade.AllusersFacade;
//import com.dmsdbj.itoo.authorizationManagement.facade.RoleFacade;
//import com.dmsdbj.itoo.authorizationManagement.facade.UserRoleFacade;
//import java.util.Date;
//import java.util.ArrayList;


/**
 * StudentController
 * student表
 *
 * @author 田成荣
 * @version 2.0.0
 * @since 2.0.0 2018-11-08 19:34:10
 */
@Api(tags = {"学生信息接口"})
@RequestMapping(value = "/student")
@RestController
public class StudentController {

    @Resource
    private StudentService studentService;

//    @Resource
//    private AllusersFacade allusersFacade;
//
//    @Resource
//    private RoleFacade roleFacade;
//
//    @Resource
//    private UserRoleFacade userRoleFacade;
//    private final DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    //region 模板生成：基本增删改
     /**
     * 添加
     *
     * @param model StudentModel
     * @return 添加的结果
     * @author 田成荣
     * @since 2.0.0 2018-11-08 19:34:10
     */
    @ApiOperation(value = "添加")
    @PostMapping(value = {"/create"})
    @Transactional(rollbackFor = Exception.class)
    public ItooResult create(@RequestBody StudentModel model) {
		if (StringUtils.isEmpty(model.getName())){
            return ItooResult.build(ItooResult.FAIL, "姓名为空");
        }
		if (StringUtils.isEmpty(model.getCode())){
            return ItooResult.build(ItooResult.FAIL, "学号为空");
        }
        StudentEntity studentEntity = new StudentEntity();
		//转换格式
        if(model.getEntranceDate() !=null){
            DateFormat format=new SimpleDateFormat("yyyy-MM-dd");
            String s =format.format(model.getEntranceDate());
            //转换为Date保存至model中
            model.setEntranceDate(java.sql.Date.valueOf(s));
        }

        BeanUtils.copyProperties(model, studentEntity);
        studentService.save(studentEntity);
        //添加角色信息
        studentService.addToAuth(studentEntity);

        return ItooResult.build(ItooResult.SUCCESS, "添加成功");
    }

    /**
     * 删除
     *
     * @param id 主键id
     * @return ItooResult 是否删除成功          
     * @author 田成荣
     * @since 2.0.0 2018-11-08 19:34:10
     */
    @ApiOperation(value = "根据id删除（单个）")
    @DeleteMapping(value = {"/delete/{id}"})
    public ItooResult delete(@ApiParam(value = "主键id", required = true) @PathVariable String id) {
        studentService.removeById(id);
        return ItooResult.build(ItooResult.SUCCESS, "删除成功");
    }

    /**
     * 批量删除
     *
     * @param ids ids
     * @return ItooResult 批量删除是否成功结果
     * @author 田成荣
     * @since 2.0.0 2018-11-08 19:34:10
     */
    @ApiOperation(value = "根据id批量删除")
    @DeleteMapping(value = {"/deleteByIds"})
    @ApiImplicitParam(name = "ids", value = "ids", dataType = "List<String>", required = true)
    public ItooResult deleteByIds(@RequestBody List<String> ids) {
        studentService.removeByIds(ids);
        // 调用权限接口，删除学生角色
//        allusersFacade.deleteUser(ids);
        return ItooResult.build(ItooResult.SUCCESS, "批量删除成功");
    }

    /**
     * 修改
     *
     * @param model StudentModel
     * @return 修改后的结果
     * @author 田成荣
     * @since 2.0.0 2018-11-08 19:34:10
     */
    @ApiOperation(value = "根据id修改student")
    @PutMapping(value = {"/modify"})
    public ItooResult modify(@RequestBody StudentModel model) {
		if (StringUtils.isEmpty(model.getName())){
            return ItooResult.build(ItooResult.FAIL, "name为空");
        }
		if (StringUtils.isEmpty(model.getCode())){
            return ItooResult.build(ItooResult.FAIL, "code为空");
        }
        StudentEntity studentEntity = new StudentEntity();
        BeanUtils.copyProperties(model, studentEntity);
        studentService.updateById(studentEntity);
        return ItooResult.build(ItooResult.SUCCESS, "修改成功");
    }

    /**
     * 根据id查找Student
     *
     * @param id 主键id
     * @author 田成荣
     * @since 2.0.0 2018-11-08 19:34:10
     */
    @ApiOperation(value = "根据id查询")
    @GetMapping(value = {"/findById/{id}"})
    public ItooResult findById(@ApiParam(value = "主键id", required = true) @PathVariable String id) {
        StudentEntity studentEntity = studentService.getById(id);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功", studentEntity);
    }

    /**
     * 分页查询所有Student
     *
     * @param pageNo   页码
     * @param pageSize 每页条数
     * @author 田成荣
     * @since 2.0.0 2018-11-08 19:34:10
     */
    @ApiOperation(value = "分页查询所有Student")
    @GetMapping(value = {"/queryPageAll/{pageNo}/{pageSize}"})
    public ItooResult queryPageAll(@ApiParam(name = "pageNo",value = "页码",required = true,example = "1")@PathVariable Integer pageNo,
                                   @ApiParam(name = "pageSize",value = "页数",required = true,example = "10")@PathVariable Integer pageSize) {
        PageInfo<StudentEntity> students = studentService.queryPageAll(pageNo, pageSize);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功", students);
    }
	
	/**
     * 根据姓名模糊查询student（郄子硕修改）
     *
     * @param name  姓名
     * @param pageNo   页码
     * @param pageSize 页数
     * @return 模糊查询的student
     * @author 田成荣
     * @since 2.0.0 2018-11-08 19:34:10
     */
    @ApiOperation(value = "根据姓名模糊查询student", notes = "分页根据姓名模糊查询student")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "姓名", dataType = "String", required = false),
            @ApiImplicitParam(name = "pageNo", value = "页码", dataType = "int", required = true, example = "1"),
            @ApiImplicitParam(name = "pageSize", value = "记录数", dataType = "int", required = true, example = "10")
    })
    @GetMapping(value = "queryStudentByLikeName/{name}/{pageNo}/{pageSize}")
    public ItooResult queryStudentByLikeName(@RequestParam(required = false, defaultValue = "") String name,
                                             @PathVariable Integer pageNo, @PathVariable Integer pageSize) {
        PageInfo<StudentEntity> studentList = studentService.queryByLikeName(name, pageNo, pageSize);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功", studentList);
    }
    //endregion

    /* **********************************以下为非模板生成的内容********************************* */

    /**
     * 根据行政班id分页查询student
     *
     * @param classId  行政班id
     * @return 查询的student
     * @author 郄子硕
     * @since 2.0.0 2018-11-13 21:47:30
     */
    @ApiOperation(value = "根据行政班id查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "classId", value = "行政班id", dataType = "String", required = true),
            @ApiImplicitParam(name = "pageNo", value = "页码", dataType = "int", required = true, example = "1"),
            @ApiImplicitParam(name = "pageSize", value = "记录数", dataType = "int", required = true, example = "10")
    })
    @GetMapping(value = "queryStudentInfoByClassId/{classId}/{pageNo}/{pageSize}")
    public ItooResult queryStudentInfoByClassId(@RequestParam(required = false, defaultValue = "") String classId,
                                                @PathVariable Integer pageNo,
                                                @PathVariable Integer pageSize) {
        PageInfo<StudentModel> teacherCourseList = studentService.queryStudentInfoByClassId(classId, pageNo, pageSize);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功", teacherCourseList);
    }

    /**
     * 分页查询所有Student（班级、学院、专业）
     *
     * @param pageNo   页码
     * @param pageSize 每页条数
     * @author 郄子硕
     * @since 2.0.0 2018-11-25 18:52:02
     */
    @ApiOperation(value = "分页查询所有Student（班级、学院、专业）")
    @GetMapping(value = {"/queryAllStudent/{pageNo}/{pageSize}"})
    public ItooResult queryAllStudent(@ApiParam(name = "pageNo",value = "页码",required = true,example = "1")@PathVariable Integer pageNo,
                                      @ApiParam(name = "pageSize",value = "页数",required = true,example = "10")@PathVariable Integer pageSize) {
        PageInfo<StudentModel> students = studentService.queryAllStudent(pageNo, pageSize);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功", students);
    }



    /**
     * 根据id查询student
     *
     * @param studentId  studentId
     * @return 查询的student
     * @author 郄子硕
     * @since 2.0.0 2018-11-13 21:47:30
     */
    @ApiOperation(value = "根据行政班id查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "studentId", value = "学生id", dataType = "String", required = true)})
    @GetMapping(value = "queryStudentInfoByStudentId/{classId}")
    public ItooResult queryStudentInfoByClassId(@RequestParam(required = false, defaultValue = "") String studentId) {
        PageInfo<StudentModel> teacherCourseList = studentService.queryStudentInfoByStudentId(studentId);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功", teacherCourseList);
    }


    /**
     * 分页根据关键词模糊查询学号或姓名student
     *
     * @param strLike  姓名或学号关键词
     * @param pageNo   页码
     * @param pageSize 每页条数
     * @return 查询的student
     * @author 郄子硕
     * @since 2.0.0 2018-11-15 14:20:45
     */
    @ApiOperation(value = "分页根据关键词模糊查询学号或姓名")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "strLike", value = "关键词", dataType = "String", required = true)
    })
    @GetMapping(value = "queryStudentInfoByCodeAndNameStrLike/{pageNo}/{pageSize}")
    public ItooResult queryStudentInfoByCodeAndNameStrLike(
            @ApiParam(name = "pageNo",value = "页码",required = true,example = "1")@PathVariable Integer pageNo,
            @ApiParam(name = "pageSize",value = "页数",required = true,example = "10")@PathVariable Integer pageSize,
            @RequestParam(required = false, defaultValue = "") String strLike) {
        PageInfo<StudentModel> teacherCourseList = studentService.queryStudentInfoByCodeAndNameStrLike(pageNo, pageSize,strLike);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功", teacherCourseList);
    }

    /**
     * 根据classId和关键词模糊查询学号或姓名student
     *
     * @param strLike  姓名或学号关键词
     * @param classId 行政班Id
     * @return 查询的student
     * @author 郄子硕
     * @since 2.0.0 2018-11-21 15:01:03
     */
    @ApiOperation(value = "根据classId和关键词模糊查询学号或姓名student")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "strLike", value = "关键词", dataType = "String"),
            @ApiImplicitParam(name = "classId", value = "行政班Id", dataType = "String", required = true),
            @ApiImplicitParam(name = "pageNo", value = "页码", dataType = "int", required = true, example = "1"),
            @ApiImplicitParam(name = "pageSize", value = "记录数", dataType = "int", required = true, example = "10")

    })
    @GetMapping(value = "queryByCodeNameAndClassId/{pageNo}/{pageSize}")
    public ItooResult queryByCodeNameAndClassId(@RequestParam(required = false, defaultValue = "") String strLike,
                                                @RequestParam(required = false, defaultValue = "") String classId,
                                                @PathVariable Integer pageNo, @PathVariable Integer pageSize) {
        PageInfo<StudentModel> teacherCourseList = studentService.queryByCodeNameAndClassId(strLike,classId,pageNo, pageSize);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功", teacherCourseList);
    }

    /**
     * 根据classID集合 查询学生信息
     *
     * @param ids ids
     * @return StudentModel
     * @author 郄子硕
     * @since 2.0.0 2018-11-15 15:44:38
     */

    @ApiOperation(value = "根据课程id集合 查询学生信息")
    @PostMapping(value = {"/queryTeacherCourseByIds"})
    @ApiImplicitParam(name = "ids", value = "ids", dataType = "List<String>", required = true)

    public ItooResult queryStudentInfoByClassIds(@RequestBody List<String> ids) {
        List<StudentModel> teacherCourseList = studentService.queryStudentInfoByClassIds(ids);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功",teacherCourseList);
    }

    /**
     * 根据姓名和学号模糊查询student
     *
     * @param name  姓名
     * @param code  姓名
     * @param pageNo   页码
     * @param pageSize 页数
     * @return 模糊查询的student
     * @author 郄子硕
     * @since 2.0.0 2018-11-17 21:23:58
     */
    @ApiOperation(value = "根据姓名和学号模糊查询student", notes = "分页根据姓名和学号模糊查询student")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "姓名", dataType = "String"),
            @ApiImplicitParam(name = "code", value = "学号", dataType = "String"),
            @ApiImplicitParam(name = "pageNo", value = "页码", dataType = "int", required = true, example = "1"),
            @ApiImplicitParam(name = "pageSize", value = "记录数", dataType = "int", required = true, example = "10")
    })
    @GetMapping(value = "queryStudentByLikeNameAndCode/{pageNo}/{pageSize}")
    public ItooResult queryStudentByLikeNameAndCode(@RequestParam(required = false, defaultValue = " ") String name,
                                                    @RequestParam(required = false, defaultValue = " ") String code,
                                                    @PathVariable Integer pageNo, @PathVariable Integer pageSize) {
        PageInfo<StudentModel> studentList = studentService.queryLikeNameAndCode(name,code, pageNo, pageSize);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功", studentList);
    }

    /**
     * 根据学生id集 查询学生集和
     *
     * @param ids ids
     * @return ItooResult 学生表List
     * @author 郄子硕
     * @since 2.0.0 2018-11-23 20:45:15
     */
    @ApiOperation(value = "根据学生id集 查询学生集和")
    @PostMapping(value = {"/queryStudentByIds"})
    @ApiImplicitParam(name = "ids", value = "ids", dataType = "List<String>", required = true)
    public ItooResult queryStudentByIds(@RequestBody List<String> ids) {
        List<StudentModel> studentList = studentService.queryStudentByIds(ids);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功",studentList);
    }

    /**
     * 根据学院id集 查询学生集和
     *
     * @param ids ids
     * @return ItooResult 学生表List
     * @author 郄子硕
     * @since 2.0.0 2018-11-29 19:11:40
     */
    @ApiOperation(value = "根据学院id集 查询学生集和")
    @PostMapping(value = {"/queryStudentByAcademyIds/{pageNo}/{pageSize}"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", value = "ids", dataType = "List<String>", required = true),
            @ApiImplicitParam(name = "pageNo", value = "页码", dataType = "int", required = true, example = "1"),
            @ApiImplicitParam(name = "pageSize", value = "记录数", dataType = "int", required = true, example = "10")
    })


    public ItooResult queryStudentByAcademyIds(@RequestBody List<String> ids,
                                               @PathVariable Integer pageNo, @PathVariable Integer pageSize) {
        PageInfo<StudentModel> studentList = studentService.queryStudentByAcademyIds(ids,pageNo,pageSize);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功",studentList);
    }

    /**
     * 根据班级id集 查询学生集和
     *
     * @param ids ids
     * @return ItooResult 学生表List
     * @author 郄子硕
     * @since 2.0.0 2018-11-29 19:11:34
     */
    @ApiOperation(value = "根据班级id集 查询学生集和")
    @PostMapping(value = {"/queryStudentByByClassIds/{pageNo}/{pageSize}"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", value = "ids", dataType = "List<String>", required = true),
            @ApiImplicitParam(name = "pageNo", value = "页码", dataType = "int", required = true, example = "1"),
            @ApiImplicitParam(name = "pageSize", value = "记录数", dataType = "int", required = true, example = "10")
    })
    public ItooResult queryStudentByByClassIds(@RequestBody List<String> ids,
                                               @PathVariable Integer pageNo, @PathVariable Integer pageSize) {
        PageInfo<StudentModel> studentList = studentService.queryStudentByByClassIds(ids,pageNo,pageSize);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功",studentList);
    }

    /**
     * 根据专业id集 查询学生集和
     *
     * @param ids ids
     * @return ItooResult 学生表List
     * @author 郄子硕
     * @since 2.0.0 2018-11-29 19:11:37
     */
    @ApiOperation(value = "根据专业id集 查询学生集和")
    @PostMapping(value = {"/queryStudentByByProfessionIds/{pageNo}/{pageSize}"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", value = "ids", dataType = "List<String>", required = true),
            @ApiImplicitParam(name = "pageNo", value = "页码", dataType = "int", required = true, example = "1"),
            @ApiImplicitParam(name = "pageSize", value = "记录数", dataType = "int", required = true, example = "10")
    })
    public ItooResult queryStudentByByProfessionIds(@RequestBody List<String> ids,
                                                    @PathVariable Integer pageNo, @PathVariable Integer pageSize) {
        PageInfo<StudentModel> studentList = studentService.queryStudentByByProfessionIds(ids,pageNo,pageSize);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功",studentList);
    }

    /**
     * 根据姓名和学号和行政班ID模糊查询student
     *
     * @param name  姓名
     * @param code  姓名
     * @param classId   行政班Id
     * @param pageNo   页码
     * @param pageSize 页数
     * @return 模糊查询的student
     * @author 郄子硕
     * @since 2.0.0 2018-11-17 21:23:58
     */
    @ApiOperation(value = "根据姓名和学号和行政班ID模糊查询student", notes = "分页根据姓名和学号和行政班ID模糊查询student")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "姓名", dataType = "String"),
            @ApiImplicitParam(name = "code", value = "学号", dataType = "String"),
            @ApiImplicitParam(name = "classId", value = "班级Id", dataType = "String"),
            @ApiImplicitParam(name = "pageNo", value = "页码", dataType = "int", required = true, example = "1"),
            @ApiImplicitParam(name = "pageSize", value = "记录数", dataType = "int", required = true, example = "10")
    })
    @GetMapping(value = "queryStudentByLikeNameAndCodeAndClassId/{pageNo}/{pageSize}")
    public ItooResult queryStudentByLikeNameAndCodeAndClassId(@RequestParam(required = false, defaultValue = " ") String name,
                                                              @RequestParam(required = false, defaultValue = " ") String code,
                                                              @RequestParam(required = false, defaultValue = " ") String classId,
                                                              @PathVariable Integer pageNo, @PathVariable Integer pageSize) {
        PageInfo<StudentModel> studentList = studentService.queryLikeNameAndCodeAndClassId(name,code,classId,pageNo, pageSize);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功", studentList);
    }

    /**
     * 查询年集合-郄子硕-2018-11-25 16:53:39
     *
     * @param startYear 开始
     * @param endYear   结束
     * @return ItooResult
     */

    @ApiOperation(value = "查询年集合", notes = "输入startYear，endYear来分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear", value = "开始",    required = true, paramType = "path"),
            @ApiImplicitParam(name = "endYear", value = "结束",    required = true, paramType = "path"),

    })
    @RequestMapping(value = {"/queryYearList/{startYear}/{endYear}"}, method = RequestMethod.GET)
    @ResponseBody
    public ItooResult queryYearList(@PathVariable("startYear") int startYear, @PathVariable("endYear") int endYear) {
        try {
            List<YearSemesterEntity> yearSemesterEntityList = YearSemester.getYearList(startYear, endYear);
            return ItooResult.build("0000", "查找最近" + (endYear - startYear + 1) + "年学年成功", yearSemesterEntityList);
        } catch (Exception e) {
            return ItooResult.build("1111", "获取最近" + (endYear - startYear + 1) + "年学年失败", e);
        }
    }


    /**
     * 导出
     *
     * @param strLike 关键词
     * @param studentCode 学生学号
     * @param studentName 学生姓名
     * @return studentmodel
     * @author 郄子硕
     * @since 2018-11-27 11:37:10
     */
    @ApiOperation(value = "导出")
    @GetMapping(value = "exportFile/exportStudentInfo")
    public ItooResult exportStaffInfo(HttpServletResponse response,
                                      @RequestParam(required = false, defaultValue = " ") String strLike,
                                      @RequestParam(required = false, defaultValue = " ") String studentCode,
                                      @RequestParam(required = false, defaultValue = " ") String studentName){
        return studentService.exportStudentInfo(response,strLike,studentCode,studentName);
    }

    /**
     * 下载教师模板，批量导入使用
     *
     * @param response 响应
     * @return 下载模板是否成功
     * @author 郄子硕
     * @since 2.0.0 2018-11-27 20:43:28
     */
    @ApiOperation(value = "下载教师授课模板，批量导入使用", notes = "下载教师授课模板，批量导入使用")
    @GetMapping(value = {"/downLoadTemplate"})
    public ItooResult downTemplate(HttpServletResponse response) {
        if (studentService.downTemplate(response)) {
            return ItooResult.build(ItooResult.SUCCESS, "下载教师授课模板成功");
        } else {
            return ItooResult.build(ItooResult.FAIL, "下载教师授课模板失败");
        }
    }

    /**
     * 批量导入student
     *
     * @param multipartFile 批量导入的文件
     * @param request       请求
     * @param response      响应
     * @return ItooResult 批量导入的结果
     * @author 郄子硕
     * @since 1.0.0 2018-11-28 19:34:25
     */
    @ApiOperation(value = "批量导入student")
    @PostMapping(value = {"/importStudent"})
    public ItooResult importStudent(@RequestParam(value = "file") MultipartFile multipartFile,
                                    HttpServletRequest request, HttpServletResponse response) {


        return studentService.importStudent(multipartFile, request, response);
    }

    /**
     * 批量导入student
     *
     * @param multipartFile 批量导入的文件
     * @param request       请求
     * @param response      响应
     * @return ItooResult 批量导入的结果
     * @author 郄子硕
     * @since 1.0.0 2018-11-28 19:34:25
     */
    @ApiOperation(value = "批量导入studentTGB")
    @PostMapping(value = {"/importStudentTGB"})
    public ItooResult importStudentTGB(@RequestParam(value = "file") MultipartFile multipartFile,
                                       HttpServletRequest request, HttpServletResponse response) {


        return studentService.importStudentTGB(multipartFile, request, response);
    }

    /**
     * 导出-导入失败的数据
     *
     * @param response  响应
     * @param errorListId 为成功导入的分组id
     * @return 学生信息model
     * @author 郄子硕
     * @since 2018-12-2 12:47:30
     */
    @ApiOperation(value = "导出-导入失败的数据")
    @GetMapping(value = "exportFile/downErrorList/{errorListId}")
    public ItooResult downErrorList(HttpServletResponse response,
                                    @ApiParam(name = "errorListId", value = "errorListId", required = true) @PathVariable String errorListId) {

        if (studentService.downErrorList(errorListId,response)){
            return ItooResult.build(ItooResult.SUCCESS,"导出成功");
        } else {
            return ItooResult.build(ItooResult.FAIL,"导出失败");
        }

    }

    /**
     * 查询所有Student
     *
     * @author 严文文
     * @since 2.0.0 2018-12-3 17:56:32
     */
    @ApiOperation(value = "查询所有Student")
    @GetMapping(value = {"/queryAll/{gradeId}"})
    public ItooResult queryAll(@ApiParam(value = "年级id", required = true) @PathVariable String gradeId) {
        List<StudentModel> students = studentService.queryAll(gradeId);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功", students);
    }


   
}    
